<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>

<%@ page import="com.pptree.service.*" %>
<%@ page import="com.pptree.service.impl.*" %>
<%@ page import="com.pptree.vo.*" %>

<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <base href="<%=basePath%>">
    
    <title>新闻分类管理</title>
    
	<meta http-equiv="pragma" content="no-cache">
	<meta http-equiv="cache-control" content="no-cache">
	<meta http-equiv="expires" content="0">    
	<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
	<meta http-equiv="description" content="This is my page">
	
	<style type="text/css">
		.gridview {
			 border: 1px solid #1E82D1;
			 border-collapse: collapse;
			 width: 100%;
			 font-size:9pt;
		}
		
		.gridview th {
			height: 30px;
			line-height: 30px;
			background: #1E82D1;
			border: 1px solid #1E82D1;
			color:#fff;
			font-size:14px;
		}
		
		.gridview td {
			height:28px;
			border: 1px solid #1E82D1;
			text-align: center;
		}
		
		.gridview .btn{
			height: 30px;
			line-height:30px;
			width: 80px;
			display: inline-block;
			background: #1E82D1;
			color:#fff;
			text-align: center;
			text-decoration: none;
			border-radius: 15px;
		}
	</style>

  </head>
  
  <body>
  	<table class="gridview">
  		<tr>
  			<th>编号</th>
  			<th>主题</th>
  			<th>创建日期</th>
  			<th>操作</th>
  		</tr>
  		<%
  			GenreService genreServiceImpl = new GenreServiceImpl();
  			List<Genre> genreList = genreServiceImpl.getAllCategories();
  			for(Genre genre : genreList) { %>
  			<tr>
  				<td><%= genre.getId() %></td>
  				<td><%= genre.getName() %></td>
  				<td><%= genre.getCreateDate().toLocaleString() %></td>
  				<td>
  					<a class="btn" href="admin/editGenre.jsp?id=<%= genre.getId() %>">修 改</a>
  					<a class="btn" href="admin/delGenre.jsp?id=<%= genre.getId() %>" onclick="return confirm('确定要删除此新闻主题吗？')">删 除</a>
  				</td>
  			</tr>
  		<% } %>
  	</table>
  </body>
</html>
